/**   
* @Title: ApplcationContext.java 
* @Package cn.com.ytst.notify.util 
* @Description: TODO(用一句话描述该文件做什么) 
* @author 123774135@qq.com 
* @date 2019年5月29日 下午3:01:19 
* @version V1.0   
*/
package cn.com.ytst.data.integration.util;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;


/** 
* @ClassName: ApplcationContext 
* @Description: 
* @author 123774135@qq.com 
* @date 2019年5月29日 下午3:01:19 
*  
*/
@Component
public class SpringContextUtil implements ApplicationContextAware{

	private static ApplicationContext applicationContext ;
	

	@Override
    @Autowired
	public void setApplicationContext(ApplicationContext applicationContext) {
		SpringContextUtil.applicationContext = applicationContext;

	}



	public static ApplicationContext getCtx() {
        return SpringContextUtil.applicationContext;
    }

    public static <T> T getBean(Class<T> t) {

        return applicationContext.getBean(t);
    }

    public static <T> T getBean(String beanname,Class<T> t) {
        return applicationContext.getBean(beanname,t);
    }




}
